import axios from '@/libs/api.request.js'
import md5 from 'md5'
import { getBrowserInfo } from '@/libs/tools.js'


export const login = ({ username, password }) => {
    const data = {
        username,
        password: md5(password),
        from: 'web',
        type: 'USER',
        browser: getBrowserInfo()
    }
    return axios.request({
        url: 'webapi?action=login',
        data,
        method: 'post'
    })
}

export const logout = ({ username, password }) => {
    const data = {
        username,
        password: md5(password),
        from: 'web',
        type: 'USER',
        browser: getBrowserInfo()
    }
    return axios.request({
        url: 'webapi?action=logout',
        data,
        method: 'post'
    })
}